In the current galaxy formation scenarios, two physical phenomena are invoked to build disk galaxies: hierarchical mergers and more quiescent external gas accretion, coming from intergalactic filaments. Although both are thought to play a role, their relative importance is not known precisely. Here we consider the constraints on these scenarios brought by the observation-deduced star formation history on the one hand, and observed dynamics of galaxies on the other hand: the high frequency of bars and spirals, the high frequency of perturbations such as lopsidedness, warps, or polar rings. All these observations are not easily reproduced in simulations without important gas accretion. N-body simulations taking into account the mass exchange between stars and gas through star formation and feedback, can reproduce the data, only if galaxies double their mass in about 10 Gyr through gas accretion. Warped and polar ring systems are good tracers of this accretion, which occurs from cold gas which has not been virialised in the system's potential. The relative importance of these phenomena are compared between the field and rich clusters. The respective role of mergers and gas accretion vary considerably with environment.